package com.niiwoo.activity.event.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Created by dengyunhui on 2018/03/21.
 */
@AllArgsConstructor
@Getter
public enum RepaymentTypeEnum {

    REPAY_PRINCIPAL_INTEREST_AT_TERM(Byte.valueOf("1"), "到期还本息"),
    AVERAGE_CAPITAL_PLUS_INTEREST(Byte.valueOf("2"), "等额本息"),
    MONTHLY_INTEREST_PAYMENT_DUE(Byte.valueOf("3"), "按月还息，到期还本");

    private Byte code;
    private String desc;

    public static RepaymentTypeEnum valueOf(Byte code) {
        for (RepaymentTypeEnum repaymentTypeEnum : RepaymentTypeEnum.values()) {
            if (code.byteValue() == repaymentTypeEnum.getCode()) {
                return repaymentTypeEnum;
            }
        }
        return null;
    }
}
